<?php
use Symfony\Component\Yaml\Dumper;
defined('BASEPATH') OR exit('No direct script access allowed');
class Setting extends AdminBase {
	public function __construct()
    {
        parent::__construct();
    }

	public function index()
	{
		$post = $this->input->post();
		$setting = $this->getSetting();
		if(empty($post)){
			$this->admin_view('setting','网站设置',$setting);
		}else{
			if($setting==$post){
				$this->output->set_content_type('application/json')
				->set_output(json_encode(array('statu' => 'ok','message'=>'没有改动！')));
				return;
			}else{
				$this->db->delete('setting', $setting);
				$this->db->replace('setting',$post);
				$this->output->set_content_type('application/json')
				->set_output(json_encode(array('statu' => 'ok','message'=>'修改成功！')));
				return;
			}
			
		}
	}

}